package com.hdoit.ares.web.advertisement.modelconfig;
import com.hdoit.ares.web.advertisement.providers.AdLocationIdListProvider;
import com.hdoit.ares.web.advertisement.providers.OpenStateProvider;
import com.tennetcn.component.attribute.DateTimeAttribute;
import com.tennetcn.common.enums.regular.MathRegularExpressions;
import com.tennetcn.component.attribute.DisplayNameAttribute;
import com.tennetcn.component.attribute.DropDownListAttribute;
import com.tennetcn.component.attribute.RequiredAttribute;
import com.tennetcn.component.attribute.RegularExpressionAttribute;
import com.tennetcn.component.attribute.base.ModelMetadataAttributeConfiguration;

/**
 * @author      yujinhui
 * @email       
 * @createtime  2018年03月13日 19:26:53
 * @comment
 */
public class AdvertisementConfig extends ModelMetadataAttributeConfiguration{
    public AdvertisementConfig(){
        this.setProperty("businessId")
            .hasAttribute(new DisplayNameAttribute("商家id"));

        this.setProperty("adLocationId")
        	.hasAttribute(new DisplayNameAttribute("广告位置"))
        	.hasAttribute(new DropDownListAttribute(new AdLocationIdListProvider()));

        this.setProperty("imgUrl")
            .hasAttribute(new DisplayNameAttribute("图片地址"));

        this.setProperty("href")
            .hasAttribute(new DisplayNameAttribute("外部链接"));

        this.setProperty("startTime")
            .hasAttribute(new DisplayNameAttribute("开始日期"))
            .hasAttribute(new DateTimeAttribute());

        this.setProperty("endTime")
            .hasAttribute(new DisplayNameAttribute("结束日期"))
            .hasAttribute(new DateTimeAttribute());

        this.setProperty("clickCount")
            .hasAttribute(new DisplayNameAttribute("点击次数"))
            .hasAttribute(new RegularExpressionAttribute(MathRegularExpressions.naturalNumber));

        this.setProperty("isOpen")
            .hasAttribute(new DisplayNameAttribute("是否开启"))
            .hasAttribute(new DropDownListAttribute(new OpenStateProvider()));

        this.setProperty("linkman")
            .hasAttribute(new DisplayNameAttribute("联系人"));

        this.setProperty("email")
            .hasAttribute(new DisplayNameAttribute("联系人email"));

        this.setProperty("phone")
            .hasAttribute(new DisplayNameAttribute("联系人电话"));

        this.setProperty("createTime")
            .hasAttribute(new DisplayNameAttribute("创建时间"))
            .hasAttribute(new DateTimeAttribute());

        this.setProperty("adName")
            .hasAttribute(new DisplayNameAttribute("广告名称"));

    }
}